﻿@model PagedList.IPagedList<Doan.Forum.Models.Topic>
@using System.Globalization 
@foreach (var item in Model)
{
    Html.RenderAction("ShowTopic", "Share", new { id = item.TopicId });
}
<script>
    $(document).ready(function () {
        var page = @ViewBag.pageNumber;
        var id = "cmpage" + page;
        $(".pagingbar a").removeClass("cmpageActive");
        $('#' + id).addClass('cmpageActive');
    });
</script>

@if (Model.PageCount > 1)
{
    <div class="pagingbar">
        @Ajax.ActionLink("Đầu", "TopicListPartial", new {page = 1}, new AjaxOptions {UpdateTargetId = "topiclist"})
        @Ajax.ActionLink("<", "TopicListPartial", new {page = Model.PageNumber - 1}, new AjaxOptions {UpdateTargetId = "topiclist"})
        @for (int i = 1; i <= Model.PageCount; i++)
        {
            var page = i.ToString(CultureInfo.InvariantCulture);
            @Ajax.ActionLink(page, "TopicListPartial", new {page = i}, new AjaxOptions {UpdateTargetId = "topiclist"}, new {@id = "cmpage" + page})
        }
        @Ajax.ActionLink(">", "TopicListPartial", new {page = Model.PageNumber + 1}, new AjaxOptions {UpdateTargetId = "topiclist"})
        @Ajax.ActionLink("Cuối", "TopicListPartial", new {page = Model.PageCount}, new AjaxOptions {UpdateTargetId = "topiclist"})
    </div>
}